﻿<UserControl x:Class="DarklandsUiCommon.Views.Quest.QuestListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:models="clr-namespace:DarklandsUiCommon.Models"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../SharedStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <ScrollViewer VerticalScrollBarVisibility="Auto" 
                  Template="{DynamicResource SlimScrollViewerControlTemplate}" 
                  PreviewMouseWheel="OnPreviewMouseWheel">

        <DataGrid ItemsSource="{Binding Quests}" CanUserAddRows="False" CanUserDeleteRows="False"
                  AutoGenerateColumns="False" SelectionMode="Single">
            <DataGrid.GroupStyle>
                <GroupStyle ContainerStyle="{StaticResource GroupWithItemCount}" />
            </DataGrid.GroupStyle>

            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow">
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="ToolTip"
                                    Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=DataContext.(models:QuestModel.Tooltip)}" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>

            <DataGrid.Columns>
                <DataGridCheckBoxColumn Header="Done" Binding="{Binding IsCompleted, Mode=OneWay}" MinWidth="40" />
                <DataGridTextColumn Header="Time left" Binding="{Binding TimeLeftComplete, Mode=OneWay}" MinWidth="60" />
                <DataGridTextColumn Header="Destination" Binding="{Binding Destination, Mode=OneWay}" MinWidth="100" />
                <DataGridTextColumn Header="Description" Binding="{Binding Description, Mode=OneWay}" MinWidth="100" Width="*" />
            </DataGrid.Columns>
        </DataGrid>

    </ScrollViewer>

</UserControl>